package com.hongkzh.www.adv.service;

import com.hongkzh.www.conmon.BigNumberFormat;
import com.jfinal.kit.PropKit;
import com.jfinal.kit.StrKit;
import com.jfinal.plugin.activerecord.Record;

public class BaseService {
    public void doFilePath(Record r){
        if(null==r) {
            return;
        }
        String imgSrc = r.getStr("imgSrc");
        String coverImgSrc = r.getStr("coverImgSrc");
        String headImg = r.getStr("headImg");
        String rheadImg = r.getStr("rheadImg");
        String background = r.getStr("background");
        String describe = r.getStr("describe");
        if (StrKit.notBlank(imgSrc)&&imgSrc.indexOf("http")<0) {

            r.set("imgSrc", PropKit.get("fileServer") + imgSrc);
        }
        if (StrKit.notBlank(coverImgSrc)&&coverImgSrc.indexOf("http")<0) {
            r.set("coverImgSrc", PropKit.get("fileServer") + coverImgSrc);
        }
        if (StrKit.notBlank(headImg)&&headImg.indexOf("http")<0) {
            r.set("headImg", PropKit.get("fileServer") + headImg);
        }
        if (StrKit.notBlank(rheadImg)&&rheadImg.indexOf("http")<0) {
            r.set("rheadImg", PropKit.get("fileServer") + rheadImg);
        }
        if (StrKit.notBlank(background)&&background.indexOf("http")<0) {
            r.set("background", PropKit.get("fileServer") + background);
        }
        if(StrKit.notBlank(describe)&&describe.indexOf("http")<0) {
            r.set("describe", PropKit.get("fileServer") + describe);
        }

        Integer  playCount= r.getInt("playCount");
        if(playCount!=null){
            r.set("playCount",BigNumberFormat.dataFormat(playCount));
        }
        Integer  shareCount= r.getInt("shareCount");
        if(shareCount!=null){
            r.set("shareCount",BigNumberFormat.dataFormat(shareCount));
        }

        Integer  praiseCount= r.getInt("praiseCount");
        if(praiseCount!=null){
            r.set("praiseCount",BigNumberFormat.dataFormat(praiseCount));
        }

        Integer  follows= r.getInt("follows");
        if(follows!=null){
            r.set("follows",BigNumberFormat.dataFormat(follows));
        }

        Integer  circle= r.getInt("circle");
        if(circle!=null){
            r.set("circle",BigNumberFormat.dataFormat(circle));
        }
        Integer  rewardCount= r.getInt("rewardCount");
        if(rewardCount!=null){
            r.set("rewardCount",BigNumberFormat.dataFormat(rewardCount));
        }

        Integer  commentCount= r.getInt("commentCount");
        if(commentCount!=null){
            r.set("commentCount",BigNumberFormat.dataFormat(commentCount));
        }

        Integer  collectionCount= r.getInt("collectionCount");
        if(collectionCount!=null){
            r.set("collectionCount",BigNumberFormat.dataFormat(collectionCount));
        }
        Integer  userCount= r.getInt("userCount");
        if(userCount!=null){
            r.set("userCount",BigNumberFormat.dataFormat(userCount));
        }
        Integer  people= r.getInt("people");
        if(people!=null){
            r.set("people",BigNumberFormat.dataFormatTenThousand(people));
        }




    }
}
